﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using clEntidad;

namespace genCrypto
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btGen_Click(object sender, EventArgs e)
        {
            StringBuilder abc1 = new StringBuilder();
            Seguridad objSeg = new Seguridad();
            bool esPrimero = false;
            byte[] abc = objSeg.cifradoSimetricoMS(tbClave.Text, "lasgaviotasblancasnovuelanalp0l0");
            for (int ix = 0; ix < 16; ix++)
            {
                if (!esPrimero)
                {
                    esPrimero = true;
                }
                else
                {
                    abc1.Append(",");
                }

                abc1.Append(abc[ix].ToString("X2"));
            }
            tbCrypt.Text = abc1.ToString();
        }

        private void tbClave_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
                SendKeys.Send("{TAB}");
        }
    }
}
